.TH E1432_SCA_DSP_DOWNLOAD 3 E1432
\fB---- NOT FOR GENERAL USE ----\fR
.SH NAME
.nf
e1432_sca_dsp_download \- Download program and data to SCA DSP(s)
.fi
.IX e1432_sca_dsp_download(3) 3
.SH SYNOPSIS
.cS
SHORTSIZ16 e1432_sca_dsp_download(E1432ID hw, SHORTSIZ16 ID,
		     LONGSIZ32 length, LONGSIZ32 *ldata)
.cE
.SH DESCRIPTION
\fIe1432_sca_dsp_download\fR downloads program and optional data to 
an individual SCA DSP or a group of SCA DSPs.

\fIhw\fR must be the result of a successful call to
\fIe1432_assign_channel_numbers\fR, and specifies the group of
hardware to talk to.

\fIID\fR is either the ID of a group of channels that was obtained by a
call to \fIe1432_create_channel_group\fR, or the ID of a single channel.

\fIlength\fR is the size of the download data block to be sent.

\fIldata\fR is a pointer to the 32 bit download data.

For \fIE1433\fR input channels, for hardware implementation reasons, this
operation downloads to both channels in a channel pair, such as channels
1 & 2.  If both channels in the pair are included in \fIID\fR, the operation
will be performed only once on that channel pair.

As a 56002, a \fIE1433A\fR input channel DSP initially expects 256 program
words, to be loaded starting at P:0 and then executed.  If \fIlength\fR is
less than 256, NOPs will be appended to complete the download.  If X:, Y:,
and/or higher P: memory are to be loaded, a secondary loader must be included
in the initial 256 words to properly place the additional download data.

To distinguish download files for the \fIE1433B\fR, the first word (four
bytes) must be the non null terminated string, "33B ".
This word is stripped and all following words are downloaded to the DSP.
The first word of this DSP56300 series download (the second in the file)
is the number of words to load before starting the program.
The next word is the address to start the downloaded program at.
Following that are the program words, which are downloaded starting at P:0.
As in the \fIE1433A\fR case, a secondary loader may be helpful
or even necessary.

Download data in either case is right justified - the 24 least significant
bits are the portion of each word that is downloaded.

Calling \fIe1432_sca_dsp_download\fR with either \fIlength\fR set to zero
or \fIldata\fR set to NULL will result in the standard SCA DSP code being
restored at the next \fIe1432_init_measure\fR call.

Since this function temporarily uses memory in the module which is also
used for the arbitray source data, this function must preceed the
function calls to pre-load the arbitrary source buffers using
\fIe1432_write_srcbuffer_data\fR.

This function is implemented only for E1433A/B SCA DSPs.

.SH "RETURN VALUE"
Return 0 if successful, a (negative) error number otherwise.
\fB_NO_ID\fR, if \fIID\fR is not a valid channel or group ID.
\fB_BUS_ERROR\fR, if any of the underlying register accesses fail.
\fB_BUFFER_TOO_SMALL\fR, if the internal buffer is too small to accomodate
\fIlength\fR words.
\fB_SCA_FIRMWARE_ERROR\fR and \fB_SCA_HOSTPORT_FAIL\fR are symptomatic of
the downloaded firmware behaving unexpectedly or the wrong amount of download
data being sent with respect to the downloaded secondary loader expectations.
.SH "SEE ALSO"
.na
e1432_dsp_exec_query
.ad
